home *** CD-ROM | disk | FTP | other *** search
- ;-------T-------T------------------------T----------------------------------;
- ;Chunky Pixel List
- ;---------------
- ;This demo is like the other pixel list demos but uses a CHUNKY8 screen type.
- ;Then screen size has been kept very small as the C2P routine is too slow,
- ;but this will be improved in the next version. The good thing is that
- ;because the routine is transparent, using a graphics card would mean that
- ;this demo would run at the maximum possible speed (ie the chunky screen
- ;would be displayable, so no c2p would be needed).
- ;
- ;Press LMB to exit.
-
- INCDIR "INCLUDES:"
- INCLUDE "games/games_lib.i"
- INCLUDE "games/games.i"
-
- CALL MACRO
- jsr _LVO\1(a6)
- ENDM
-
- SECTION "DrawPixel",CODE
-
- ;===========================================================================;
- ; INITIALISE DEMO
- ;===========================================================================;
-
- STARTGMS
-
- Start: MOVEM.L A0-A6/D1-D7,-(SP)
- move.l GMSBase(pc),a6
- CALL AllocBlitter
- tst.l d0
- bne.s .Error_Blitter
-
- lea ScreenTags(pc),a0
- CALL ShowScreen
- tst.l d0
- beq.s .Error_Screen
-
- CALL InitJoyPorts
-
- bsr.s Main
-
- .ReturnToDOS
- move.l GMSBase(pc),a6
- move.l Screen(pc),a0
- CALL DeleteScreen
- .Error_Screen
- CALL FreeBlitter
- .Error_Blitter
- MOVEM.L (SP)+,A0-A6/D1-D7
- moveq #ERR_OK,d0
- rts
-
- ;===========================================================================;
- ; MAIN LOOP
- ;===========================================================================;
-
- Main: move.l Screen(pc),a0
- lea MList(pc),a2 ;a2 = Pointer to pixel list.
- .loop moveq #BUFFER1,d0
- CALL ClrScreen
-
- move.l a2,a3 ;Drop the pixels here.
- moveq #31-1,d7
- .drop addq.w #1,2(a3) ;a3 = YCoord+1
- subq.l #1,4(a3) ;a3 = (Colour)-1
- bge.s .colok
- clr.l 4(a3)
- .colok addq.w #8,a3
- dbra d7,.drop
-
- lea MouseX(pc),a5
- moveq #JPORT1,d0
- CALL ReadMouse
- btst #MB_LMB,d0
- bne.s .done
- move.w d0,d1
- ext.w d1 ;d1 = Extend the Y byte.
- add.w d1,2(a5) ;d1 = (MouseY)+ChangeY
- asr.w #8,d0 ;d0 = Extend the X byte.
-
- add.w (a5),d0
- .ChkRX cmp.w GS_ScrWidth(a0),d0
- blt.s .ChkLX
- move.w GS_ScrWidth(a0),(a5)
- bra.s .Calculate
-
- .ChkLX tst.w d0
- bgt.s .okX
- clr.w (a5)
- bra.s .Calculate
- .okX move.w d0,(a5)
-
- .Calculate
- move.l (a5),-(sp)
- moveq #2,d1
- CALL FastRandom
- subq.w #1,d0
- add.w d0,(a5)
-
- moveq #2,d1
- CALL FastRandom
- subq.w #1,d0
- add.w d0,2(a5)
-
- move.l a2,a3
- moveq #31-1,d7
- .tloop move.l 8(a3),(a3)
- move.l 12(a3),4(a3)
- addq.w #8,a3
- dbra d7,.tloop
-
- lea PixelList(pc),a1 ;a1 = Pixel list.
- moveq #BUFFER1,d0 ;d0 = Destination buffer.
- CALL DrawPixelList ;>> = Draw pixels with clipping.
- move.l (sp)+,(a5)
- CALL WaitVBL
- bra .loop
- .done rts
-
- ;===========================================================================;
- ; DATA
- ;===========================================================================;
-
- ScreenTags:
- dc.l TAGS_GAMESCREEN
- Screen: dc.l 0
- dc.l GSA_ScrWidth,256
- dc.l GSA_ScrHeight,128
- dc.l GSA_Palette,.palette
- dc.l GSA_AmtColours,32
- dc.l GSA_ScrType,CHUNKY8
- dc.l GSA_Attrib,CENTRE
- dc.l TAGEND
-
- .palette
- dc.l $000000,$101010,$171717,$202020,$272727,$303030,$373737,$404040
- dc.l $474747,$505050,$575757,$606060,$676767,$707070,$777777,$808080
- dc.l $878787,$909090,$979797,$a0a0a0,$a7a7a7,$b0b0b0,$b7b7b7,$c0c0c0
- dc.l $c7c7c7,$d0d0d0,$d7d7d7,$e0e0e0,$e0e0e0,$f0f0f0,$f7f7f7,$ffffff
-
- PixelList:
- dc.w 32,PXL_SIZEOF ;Amount of entries, EntrySize.
- dc.l MList ;Pointer to pixel list array.
- MList PIXEL 16,12,00 ;First pixel to draw (at back)
- PIXEL 16,12,00 ;X/Y/Colour
- PIXEL 16,12,00 ;..
- PIXEL 16,12,00 ;..
- PIXEL 16,12,00 ;..
- PIXEL 16,12,00 ;..
- PIXEL 16,12,00 ;..
- PIXEL 16,12,00 ;..
- PIXEL 16,12,00 ;..
- PIXEL 16,12,00 ;..
- PIXEL 16,12,00 ;..
- PIXEL 16,12,00 ;..
- PIXEL 16,12,00 ;..
- PIXEL 16,12,00 ;..
- PIXEL 16,12,00 ;..
- PIXEL 16,12,00 ;..
- PIXEL 16,12,00 ;..
- PIXEL 16,12,00 ;..
- PIXEL 16,12,00 ;..
- PIXEL 16,12,00 ;..
- PIXEL 16,12,00 ;..
- PIXEL 16,12,00 ;..
- PIXEL 16,12,00 ;..
- PIXEL 16,12,00 ;..
- PIXEL 16,12,00 ;..
- PIXEL 16,12,00 ;..
- PIXEL 16,12,00 ;..
- PIXEL 16,12,00 ;..
- PIXEL 16,12,00 ;..
- PIXEL 16,12,00 ;..
- PIXEL 16,12,00 ;..
- MouseX PIXEL 16,12,31 ;Last pixel to draw (in front)
-
-